﻿<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>吧列表</title>
<link rel="stylesheet" type="text/css" href="<s:property value="staticsRoot"/>/css/style.css"/>
<script type="text/javascript" src="<s:property value="staticsRoot"/>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
	    $(".data tr:odd").css("background","#fff");
	});
	function delBar(id){
		$.getJSON("delBar.html", {"id":id}, function(result){ 
		if(result.status == '1' ){
		 alert("删除成功");
		 $("#tr_"+id).hide();
		}
		}, "json");
	}
	
	function lockBar(id,status){
		$.getJSON("lockBar.html", {"id":id,"status":status}, function(result){ 
		if(result.status == '1' ){
		if(status=='1'){
		alert("操作成功！");
		}else{
		alert("解除禁止成功！");
		}
		 window.location.reload()
		}
		}, "json");
	}
	function hotBar(id,hot){
		$.getJSON("hotBar.html", {"id":id,"hot":hot}, function(result){ 
		if(result.status == '1' ){
		if(hot=='1'){
		alert("设置热门吧成功");
		}else{
		alert("取消热门吧成功");
		}
		 window.location.reload()
		}
		}, "json");
	}
	
	function query(){
		$("#form1").submit();
	}
	
	function doSearch(pageNumber){
		if(pageNumber <= 0){
			pageNumber = 1;
		}	
		$("#page").val(pageNumber); 
		$("#form1").submit(); 
	}
</script>
</head>

<body id="user_mag">
<div class="right">
	<h3 class="title box">
    	当前位置：k吧后台管理&nbsp;&gt;&gt;&nbsp;吧管理&nbsp;&gt;&gt;&nbsp;列表
    </h3>
     <form name="form1" id="form1" action="barList.html" method="post">
    <table cellpadding="0" cellspacing="0" width="100%" class="table_top box">
    <tr>
    </tr>
    	<tr>
        	<td width="60%" height="50" align="right">
            	<select class="select" name = "type">
                	<option value ="0" <s:if test="type==0">selected</s:if>>吧名称</option>
                </select>
                <input type="text" name = "keyword" class="i_text"  value="<s:property value="keyword"/>"/>
            </td>
            <td align="left" style="padding-left:10px;">
            	<div class="lit_btn">
                   <a href="#" onclick="query()">查&nbsp;询 </a> 
                </div>
                <div class="lit_btn">
                    <a href="<s:property value="domainRoot"/>/addBar.html"  target="_blank">创建新吧</a>
                </div>
            </td>
        </tr>
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" class="data">
    	<tr>
            <td width="14%" align="center">用户名</td>
            <td width="32%" align="center">吧名</td>
            <td width="8%" align="center">状态</td>
            <td width="8%" align="center">是否热吧</td>
            <td width="16%" align="center">修改时间</td>
            <td width="20%" align="center" >操作</td>
        </tr>
        <s:iterator value="#request.list" var="bar">
        	<tr id="tr_<s:property value="#bar.id"/>">
	            <td><s:property value="#request.userMap.get(#bar.createUserId).nick"/></td>
	            <td> <a href="<s:property value="domainRoot"/>/listThread.html?barId=<s:property value="#bar.id"/>"  target="_blank"><s:property value="#bar.name"/></a></td>
	            <td><s:if test="#bar.status == 0">允许发帖</s:if><s:if test="#bar.status == 1">禁止发帖</s:if></td>
	            <td><s:if test="#bar.hot == 0">否</s:if><s:if test="#bar.hot == 1">是</s:if></td>
	            <td>i<s:date name="#bar.modifiedTime" format="yyyy-MM-dd HH:mm:ss" /></td>
	            <td><s:if test="#bar.status == 0"><a href="#" onclick = "lockBar('<s:property value="#bar.id"/>','1')" >禁止发帖</a></s:if><s:if test="#bar.status == 1"><a href="#" onclick = "lockBar('<s:property value="#bar.id"/>','0')" >允许发帖</a></s:if>&nbsp;<s:if test="#bar.hot == 0"><a href="#" onclick = "hotBar('<s:property value="#bar.id"/>','1')" >设置热门吧</a></s:if><s:if test="#bar.hot == 1"><a href="#" onclick = "hotBar('<s:property value="#bar.id"/>','0')" >取消热门吧</a></s:if> <a href='editBarCms.html?id=<s:property value="#bar.id"/>'>设置吧CMS</a> <a href='addImage.html?id=<s:property value="#bar.id"/>'>设置背景</a></td>
        	</tr>
        </s:iterator>
        
    </table>
    <%@include file="page.jsp" %>
     </form>
</div>
</body>
</html>
